﻿using System.Collections.Generic;
using System.Windows.Forms;
using TemplateGenerator.Entities;

namespace TemplateGenerator {
	public partial class ThisAddIn {

		private void ThisAddIn_Startup(object sender, System.EventArgs e) {
            GeneratorHandler.WordApp = Application;
			GeneratorHandler.LoadTemplates();

            StartingUp();
		}

		private void ThisAddIn_Shutdown(object sender, System.EventArgs e) {
		}

		private void StartingUp() {
			switch (Application.Version) {
				case "14.0":
					AppProperties.LocalWordVersion = WordVersion.Word2010;
					break;
				case "12.0":
					AppProperties.LocalWordVersion = WordVersion.Word2007;
					break;
				case "10.0":
					AppProperties.LocalWordVersion = WordVersion.Word2003;
					break;
				default:
					AppProperties.LocalWordVersion = WordVersion.Other;
					break;
			}
		}





		#region VSTO generated code

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InternalStartup() {
			this.Startup += new System.EventHandler(ThisAddIn_Startup);
			this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
		}

		#endregion
	}
}
